﻿using System;
using System.Collections.Generic;
using EnvDTE;
using EnvDTE80;


namespace VsTortoiseSVN.Commands
{
    public class SolutionExplorerSelectedItemsDiff : SolutionExplorerSelectedItemsBase
    {
        public SolutionExplorerSelectedItemsDiff(DTE2 application, string name, string caption, string tooltip, int bitmapId)
            : base(application, name, caption, tooltip, bitmapId)
        {
            SupportFilter = false;
            SupportFolder = false;
            SupportProject = false;
            SupportSolution = false;
        }

        protected override vsCommandStatus QueryContextSensitiveStatus()
        {
            List<string> fullNames = GetFullNames();
            if(SvnHelper.IsDiffable(fullNames[0]))
                return vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;

            return vsCommandStatus.vsCommandStatusEnabled;
        }

        protected override vsCommandStatus QueryContextInsensitiveStatus()
        {
            return vsCommandStatus.vsCommandStatusUnsupported;
        }

        public override bool Exec()
        {
            List<string> fullNames = GetFullNames();
            TortoiseProc.Diff(fullNames[0]);
            return true;
        }
    }
}
